
class ADCDriver
{
public:
	enum Channels { Pressure = 0, InputCurrent = 1, ExternalTemp = 2, RH = 3, InternalCurrent = 4, ForceGauge = 5, Temp=6, Power5V=7 }; 

public:
	bool Init();
	void Update();
	float GetValue(Channels channel);
	unsigned char GetStatus();

private:
	void SetupSPI();
	unsigned char WriteByte(unsigned char data);
	void Reset();
	unsigned char ReadID();
	void BeginConversion(Channels channel, int gain, bool useRef2);  // GAIN: 0->1, 1->2, 2->4, 3->8, 4->16, 5->32, 6->64, 7->128
	bool ConversionIsDone(); 
	unsigned int GetResult();
	unsigned char ReadStatusReg();
	int counterChannel;

private:
	int m_currentChannel;

	unsigned char m_statusByte;

	// channels
	float m_Channels[8];
};
